package com.spi.soconversion.base.definition;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import com.spi.soconversion.util.SOCConstants;
import com.spi.soconversion.util.XMLTagConstants;
public class SOCOrderNotes {
		private List<SOCOrderNote> orderNoteList = new ArrayList<SOCOrderNote>();
		
		public boolean addOrderNote(SOCOrderNote on){
			boolean status = false;
			if(!orderNoteList.contains(on)) {
				status = orderNoteList.add(on);
			}
			
			return status;
		}
		
		public boolean removeOrderNote(SOCOrderNote on){
			boolean status = false;
			status = orderNoteList.remove(on);
					
			return status;
		}

		public List<SOCOrderNote> getOrderNoteList(){
			return orderNoteList;		
		}
		
		@Override
		public String toString()
		{
			StringBuilder sb = new StringBuilder();
			
			if(orderNoteList!=null && orderNoteList.size()>0)
			{
				sb.append(XMLTagConstants.START_TAG_NOTES);
				Iterator<SOCOrderNote> iter=orderNoteList.iterator();
	    		while(iter.hasNext())
		    	{
	    			sb.append(SOCConstants.NEW_LINE);
	    			sb.append(iter.next().toString());  
				}
	    		sb.append(SOCConstants.NEW_LINE);
	    		sb.append(XMLTagConstants.END_TAG_NOTES);
	    		
			}
			
			return sb.toString();
		}
}
